package com.sky.mapper;

import com.sky.dto.GoodsSalesDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface ReportMapper {
    /**
     * 获取营业额列表
     * select sum(amount) from orders where order_time between #{beginTime} and #{endTime} and Status = #{COMPLETED}
     */
     BigDecimal sumAmount(Map map);

    /**
     * 获取当日总人数
     * @param endTime
     * @return
     */
    @Select("select count(*) from user where create_time <= #{endTime}")
    Integer countAllUser(LocalDateTime endTime);

    /**
     * 获取当日新增人数
     * @param beginTime
     * @param endTime
     * @return
     */
    @Select("select count(*) from user where create_time <= #{endTime} and create_time >= #{beginTime}")
    Integer countNewUser(LocalDateTime beginTime, LocalDateTime endTime);
    /**
     * 订单统计
     * @param beginTime
     * @param endTime
     * @param status
     * @return
     */
    Integer orderCount(LocalDateTime beginTime, LocalDateTime endTime,Integer status);

    /**
     * 查询top10的菜品名 和销量
     * @param beginTime
     * @param endTime
     * @return
     */
    List<GoodsSalesDTO> top10(LocalDateTime beginTime, LocalDateTime endTime);
}
